<template>
	<view class="dataStatisticsDetDL">
		<u-navbar title="车辆详情" :background="background" title-color="#fff" back-icon-color="#fff"></u-navbar>
		<view class="dataStatisticsDet-list-con">
			<view class="dataStatisticsDet-list-title">
				<view class="dataStatisticsDet-time dataStatisticsDet-list-title-bg">结算时间</view>
				<view class="dataStatisticsDet-carNumber dataStatisticsDet-list-title-bg">车牌号</view>
				<view class="dataStatisticsDet-enterprise dataStatisticsDet-list-title-bg">客户</view>
				<view class="dataStatisticsDet-enterprise dataStatisticsDet-list-title-bg">企业</view>
				<view class="dataStatisticsDet-materiel dataStatisticsDet-list-title-bg">结算物料</view>
				<view class="dataStatisticsDet-unitPrice dataStatisticsDet-list-title-bg" >物料单价</view>
				<view class="dataStatisticsDet-weight dataStatisticsDet-list-title-bg">结算重量</view>
				<view class="dataStatisticsDet-money dataStatisticsDet-list-title-bg" >结算金额</view>
				<view class="dataStatisticsDet-money dataStatisticsDet-list-title-bg" >运费</view>
				<view class="dataStatisticsDet-money dataStatisticsDet-list-title-bg" >回执重量</view>
				<view class="dataStatisticsDet-enterprise dataStatisticsDet-list-title-bg" >配送地</view>
				<view class="dataStatisticsDet-enterprise dataStatisticsDet-list-title-bg" >配送工地</view>
			</view>
			<view class="dataStatisticsDet-list-ul">
				<view v-for="(item,index) in detailsList" :key='index'>
					<view class="dataStatisticsDet-time">
						<view>{{item.SALTB410CA101}}</view>
						<view>{{item.SALTB410CA102}}</view>
					</view>
					<view class="dataStatisticsDet-carNumber">{{item.SALTB410CA01}}</view>
					<view class="dataStatisticsDet-enterprise">{{item.SETTB99CA01}}</view>
					<view class="dataStatisticsDet-enterprise">{{item.SETTB99CA01}}</view>
					<view class="dataStatisticsDet-materiel">{{item.SALTB410CA04}}</view>
					<view class="dataStatisticsDet-unitPrice" >{{item.SALTB410CA05}}</view>
					<view class="dataStatisticsDet-weight">{{item.SALTB410CA12}}</view>
					<view class="dataStatisticsDet-money">{{item.SALTB410CA13}}</view>
					<view class="dataStatisticsDet-money">{{item.SALTB410CA13}}</view>
					<view class="dataStatisticsDet-money">{{item.SALTB410CA13}}</view>
					<view class="dataStatisticsDet-enterprise">{{item.SETTB99CA01}}</view>
					<view class="dataStatisticsDet-enterprise">{{item.SETTB99CA01}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				background: {
					backgroundColor: '#00a1f1',
				},
				userinfo:JSON.parse(uni.getStorageSync('userinfo')),
				detailsList:[],
				AuthorizationOBJ:'',
			}
		},
		onLoad(option) {
			if(this.userinfo.sign == 'CUS-3'){
				this.queryAuthorization()
			}
			this.carNumber = option.carNumber
			this.startTime = option.startTime
			this.endTime = option.endTime
			// console.log(option)
		},
		mounted() {
			// this.queryDetails()
		},
		methods: {
			queryAuthorization(){//查询子账户权限
				uni.showLoading({
					title: '加载中...',
					mask:true
				});
				uni.request({
					url: this.baseUrl + '/orm/ormtb417/selectAccess/'+this.userinfo.ORMTB417ID, 
					method: 'GET',
					success: (res) => {
						console.log(res);
						uni.hideLoading();
						if (res.data.code == 200) {	
							this.AuthorizationOBJ=res.data.data
						}else{
							this.$refs.uToast.show({
								title: res.data.message,
								type: 'default',
								icon:false
							})
						}
					},
					fail: (res) => {
						uni.hideLoading();
						this.$refs.uToast.show({
							title: res.errMsg,
							type: 'default',
							icon:false
						})
					}
				});
			},
			queryDetails() {
				uni.showLoading({
					title: '请求中...',
					mask: true
				});
				uni.request({
					url: this.baseUrl + '/count/v1/count108',
					method: 'POST',
					dataType: 'json',
					data: {
						SETTB131ID: this.userinfo.SETTB131ID,
						SETTB116ID: this.userinfo.SETTB116ID,
						startTime:this.startTime,
						endTime:this.endTime,
						SALTB410CA01:this.carNumber,
					},
					success: (res) => {
						// console.log(res);
						if (res.data.result == 1) {
							this.detailsList=res.data.data
						} else {
							this.detailsList=[]
							uni.showToast({
								title: res.data.message,
								duration: 5000,
								icon: 'none',
							});
						}
						uni.hideLoading();
					},
					fail: (res) => {
						uni.hideLoading();
						uni.showToast({
							title: res.errMsg,
							duration: 5000,
							icon: 'none',
						});
					}
				});
			},
		}
	}
</script>

<style scoped>
	/* 列表 */
	.dataStatisticsDet-list-con{
		white-space: nowrap;
		overflow-x: auto;
		overflow-y: auto;
		/* margin-top: 146rpx; */
		padding-top: 40rpx;
		background: #fff;
		padding-bottom: 72rpx;
	}
	.dataStatisticsDet-list-title {
		width: 100%;
		font-size: 0;
		padding: 0 24rpx;
		background: #F2F2F2;
	}
	
	.dataStatisticsDet-list-title>view {
		display: inline-block;
		font-size: 24rpx;
		text-align: center;
		color: #999;
		padding: 18rpx 0;
	}
	.dataStatisticsDet-list-title-bg{
		background: #F2F2F2;
	}
	.dataStatisticsDet-time{
		width: 194rpx;
		/* background: red; */
	}
	.dataStatisticsDet-carNumber {
		width: 166rpx;
		/* background: yellow; */
	}
	.dataStatisticsDet-enterprise {
		width: 200rpx;
		/* background: red; */
	}
	.dataStatisticsDet-materiel {
		width: 194rpx;
		/* background: yellow; */
	}
	.dataStatisticsDet-unitPrice {
		width: 144rpx;
		/* background: red; */
	}
	
	.dataStatisticsDet-weight {
		width: 194rpx;
		/* background: yellow; */
	}
	
	.dataStatisticsDet-money {
		width: 194rpx;
		/* background: red; */
	}
	
	.dataStatisticsDet-list-ul {
		background-color: #fff;
		font-size: 0;
		padding: 0 24rpx;
	}
	.dataStatisticsDet-list-ul>view>view {
		display: inline-block;
		vertical-align: middle;
		font-size: 28rpx;
		padding: 10rpx 7rpx;
		color: #333;
		text-align: center;
		overflow: hidden;
		text-overflow:ellipsis;
		white-space: nowrap;
	}
</style>
